const http = require('http')
const PORT = 3000

const server = http.createServer(function (req, res) {
  if (req.url === '/api') {
    res.writeHead(200, { 'Content-Type': 'application/json' })
    const data = {
      message: 'Hello World!'
    }
    res.write(JSON.stringify(data))
    res.end()
  }
})

server.listen(PORT, function () {
  console.log(`Server is listening on port ${PORT}`)
})

// export default server
